<% content_for :content do %>

  <!-- widget grid -->
  <section id="widget-grid" class="">
    
    <!-- row -->
    <div class="row">
      <!-- NEW WIDGET START -->
      <article class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
        

        <!-- Widget ID (each widget will need unique ID)-->
        <div class="jarviswidget jarviswidget-color-darken" id="wid-id-1" data-widget-editbutton="false" data-widget-colorbutton="false" data-widget-deletebutton="false">
          <!-- widget options:
          usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false">

          data-widget-colorbutton="false"
          data-widget-editbutton="false"
          data-widget-togglebutton="false"
          data-widget-deletebutton="false"
          data-widget-fullscreenbutton="false"
          data-widget-custombutton="false"
          data-widget-collapsed="true"
          data-widget-sortable="false"

          -->
          <header>
            <span class="widget-icon"> <i class="fa fa-table"></i> </span>
            <h2>连接列表</h2>
          </header>

          <!-- widget div-->
          <div>

            <!-- widget edit box -->
            <div class="jarviswidget-editbox">
              <!-- This area used as dropdown edit box -->
            </div>
            <!-- end widget edit box -->
            
            <!-- widget content -->
            <div class="widget-body no-padding">

              <p class="alert alert-info no-margin">
                <span class="">
                  <i class="fa-fw fa fa-info"></i>共有<%= @app_connections.total_count if @app_connections %>条记录
                </span>
                <span style="float:right">
                  <a class="btn btn-default btn-sm" style="margin-top:-6px;" href="<%= admin_app_connections_path(format: :csv) %>">导出为CSV</a>
                </span>
              </p>

              <table class="table table-bordered table-striped">
                <thead>
                  <tr>
                    <th>APP</th>
                    <th>时长</th>
                    <th>时间</th>
                  </tr>
                </thead>
                <tbody>
                <% @app_connections.each do |connection| %>
                  <tr id='connection-<%= connection.id %>'>
                    <td>
                      <%= connection.app.mac %>
                    </td>
                    
                    <td>
                      <%= connection.duration %> 
                    </td>
                    <td>
                      <%= connection.created_at.stamp("2013-03-12 22:01:01") %> 
                    </td>
                  </tr>
                <% end %>
                </tbody>
              </table>

              <div class="dt-row dt-bottom-row"><div class="row"><div class="col-sm-12 text-right"><%= paginate @app_connections %></div></div></div>

            </div>
            <!-- end widget content -->

          </div>
          <!-- end widget div -->

        </div>
        <!-- end widget -->
  
      </article>
      <!-- WIDGET END -->

    </div>
  
    <!-- end row -->
 
  </section>
  <!-- end widget grid -->
<% end %>